package rmhc.api.vk 
{
	import rmhc.api.ApiWrapper;
	import rmhc.api.dataflow.UserInfo;
	import rmhc.api.tasks.IGetUserInfo;
	import rmhc.gui.customTrace;
	/**
	 * ...
	 * @author mick
	 */
	public class GetUserInfoTask extends VkApiTask implements IGetUserInfo
	{
		private var userInfo:UserInfo;
		public function GetUserInfoTask(wrapper:ApiWrapper , userId:String = null) 
		{
			customTrace("GetUserInfoTask:GetUserInfoTask:" );
			var uids:String;
			var fields:String =  "uid,first_name,last_name,nickname,sex";
			if(userId){
				uids =  userId;
			}else {
				uids = wrapper.getUID();
			}
			super(wrapper, "getProfiles" , { "fields" : fields, "uids":uids } );
		}
		override public function parseData(result:Object):void
		{
			userInfo = parseUserInfo( result[0] );
			customTrace("GetUserInfoTask:parseData: userInfo = "+userInfo );
			onComplete();
			
		}
		public function getUserInfo():UserInfo {
			return userInfo;
		}
	}

}